package com.unitechs.trap.write.webapi.service.impl;

import com.unitechs.trap.common.pojo.trap.entity.TrapVarValue;
import com.unitechs.trap.excel.service.ITrapVarValueExcelService;
import com.unitechs.trap.write.service.ITrapVarValueService;
import com.unitechs.trap.write.webapi.mapper.TrapVarValueMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@DubboService
@Slf4j
@Service

public class TrapVarValueServiceImpl implements ITrapVarValueService {

    @Autowired
    private TrapVarValueMapper trapVarValueMapper;
    @DubboReference(timeout = 1*1024*1024*1024)
    private ITrapVarValueExcelService trapVarValueExcelService;


    @Override
    public int insertTrapVarValues() {

        List<TrapVarValue> trapVarValues=trapVarValueExcelService.listTrapVarValue();
        log.info("trapVarValues{}",trapVarValues);
        if (trapVarValues==null||trapVarValues.isEmpty()){
            return 0;
        }
        int i = trapVarValueMapper.insertTrapVarValues(trapVarValues);
        return i;

    }
}
